{% load i18n %}
{% if page_obj.has_next or page_obj.has_previous %}
<div class="g-js b-pager" onclick="return {name: 'b-pager'}">
    <b class="b-pager__title">{% trans "Pages" %}</b>

    {% if page_obj.has_previous %}
        <span class="b-pager__active">
             <i class="b-pager__key"><i class="b-pager__arr">&#8592;</i> Ctrl</i> <a class="b-pager__prev" href="?page={{ page_obj.previous_page_number }}">предыдущая</a>
        </span>
    {% else %}
        <span class="b-pager__inactive">
            <i class="b-pager__key"><i class="b-pager__arr">&#8592;</i> Ctrl</i> {% trans "Pevious" %}
        </span>
    {% endif %}

    {% if page_obj.has_next %}
        <span class="b-pager__active">
            <a class="b-pager__next" href="?page={{ page_obj.next_page_number }}">{% trans "Next" %}</a> <i class="b-pager__key">Ctrl <i class="b-pager__arr">&#8594;</i></i>
        </span>
    {% else %}
        <span class="b-pager__inactive">
            следующая <i class="b-pager__key">Ctrl <i class="b-pager__arr">&#8594;</i></i>
        </span>
    {% endif %}

    <div class="b-pager__pages">
        {% for p in previous_list|slice:"-8:" %}
        <a class="b-pager__page" href="?page={{ p }}">{% if forloop.first and previous_list|slice:":-8" %}&hellip;{% else %}{{ p }}{% endif %}</a>
        {% endfor %}
        <b class="b-pager__current">{{ page_obj.number }}</b>
        {% for p in next_list|slice:":8" %}
        <a class="b-pager__page" href="?page={{ p }}">{% if forloop.last and next_list|slice:"8:" %}&hellip;{% else %}{{ p }}{% endif %}</a>
        {% endfor %}
    </div>
</div>
{% endif %}
